#! /usr/bin/env python3
import sys
import cmd
from classpath import classpath
from classfile import class_reader
from classfile import class_file


def startJVM(parseCmd):
    cp=classpath.Parse(parseCmd.xJreOption,parseCmd.cpOption)
    data=cp.readClass(parseCmd.className.replace('.','/'))
    print(data)
    classFile=class_file.ClassFile()
    classFile.parse(data)
    # classReader=class_reader.ClassReader()
    # classReader.data=data
    #print(classReader.readBytes())
    # print(classReader.readUnit8())
    # print(classReader.readUnit16())
    # print(classReader.readUnit32())
    # print(classReader.readUnit64())
    # print("16s===",classReader.readUnit16s())
    #print(cp.String())


parseCmd = cmd.parseCmd()
if parseCmd.versionFlag:
    print('version 0.0.1')
elif parseCmd.helpFlag or parseCmd.className == '':
    cmd.printUsage()
else:
    startJVM(parseCmd)



